﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ServiceModel;
using NGinnBPM.Lib.Schema;

namespace NGinnBPM.Lib.Interfaces
{
   

    /// <summary>
    /// NGinn Facade interface aggregating most
    /// frequently used functions.
    /// </summary>
    [ServiceContract]
    public interface INGinn
    {
        [OperationContract]
        PackageDefinition GetPackageDefinition(string name);
        
        [OperationContract]
        ProcessDefinition GetProcessDefinition(string definitionId);

        [OperationContract]
        string[] GetPackageNames();

        [OperationContract]
        void CancelTask(string instanceId);

        [OperationContract]
        void FailTask(string instanceId, string errorInfo);

        [OperationContract]
        void CompleteTask(string instanceId, Dictionary<string, object> updatedData, string completedBy);

        [OperationContract]
        void UpdateTaskData(string instanceId, Dictionary<string, object> updatedData);

        [OperationContract]
        string StartProcess(string definitionId, Dictionary<string, object> inputData, string startedBy, string externalId);

        /// <summary>
        /// Check if specified task is enabled in a process instance (if there's a currently active instance of this task)
        /// </summary>
        /// <param name="processInstanceId"></param>
        /// <param name="taskId"></param>
        /// <returns></returns>
        [OperationContract]
        bool IsTaskEnabled(string processInstanceId, string taskId);

        /// <summary>
        /// Get task instance information
        /// </summary>
        /// <param name="instanceId"></param>
        /// <returns></returns>
        [OperationContract]
        TaskInstanceInfo GetTaskInstanceInfo(string instanceId);

    }
}
